# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=findutils
pkgver=4.7.0
pkgrel=1
pkgdesc="GNU utilities to locate files"
arch=('i686' 'x86_64')
license=('GPL3')
groups=('base')
depends=('libiconv' 'libintl')
makedepends=('libiconv-devel' 'gettext-devel')
url="https://www.gnu.org/software/findutils"
source=(https://ftp.gnu.org/pub/gnu/findutils/${pkgname}-${pkgver}.tar.xz{,.sig}
        findutils-4.7.0-msysize.patch)
install=findutils.install
sha256sums=('c5fefbdf9858f7e4feb86f036e1247a54c79fc2d8e4b7064d5aaa1f47dfa789a'
            'SKIP'
            'b720cddb54958d4500e43fefedef3b91a6a2104641feacfdca1bbecd95c543b5')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i ${srcdir}/findutils-4.7.0-msysize.patch

  autoreconf -fi
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  # Don't build or install locate because we use mlocate,
  # which is a secure version of locate.
  # sed -i '/^SUBDIRS/s/locate//' Makefile.in

  ./configure \
    --build=${CHOST} \
    --prefix=/usr \
    --without-libiconv-prefix \
    --without-libintl-prefix \
    DEFAULT_ARG_SIZE="(32u*1024)"

  make
}

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make check
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR=${pkgdir} install
}
